package com.ioday01demo;

import java.io.*;
import java.nio.charset.StandardCharsets;

/*
缓冲字符流 加快字符流的读写
 */
public class PWDemo {
    public static void main(String[] args) throws IOException {
        PrintWriter pw = new PrintWriter("pw.txt");
        pw.println("aaaa");//换行缓冲转换字符流
        pw.println("aaaa");
        pw.close();



       /* FileOutputStream fos = new FileOutputStream("pw.txt");
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        String s = "啊啊啊啊";
        bw.write(s);
        bw.close();//缓冲流关闭的时候会调用flush方法 将底层数组的数据读写*/

    }
}
